package com.daatak.user.domain;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.transaction.annotation.Transactional;



@Entity
@Table(name="USERS") 
public class UserObject{
	
	@Id
	@GeneratedValue
	@Column(name="ID") 
	Integer userId;
	
	@Column(name="REF_ID") 
	private Integer referenceId;
	
	
	@Column(name="USER_NAME") 
	private String userName;
	
	@Column(name="PASSWORD") 
	private String password;
	
	@Column(name="CREATED_BY") 
	private Integer createdBy;
	
	@Column(name="FIRST_NAME") 
	private String firstName;
	
	@Column(name="LAST_NAME") 
	private String lastName;
	
	@Column(name="QUESTION") 
	private String question;
	
	@Column(name="ANSWER") 
	private String answer;
	
	@Column(name="CREATED_DATE") 
	private Date createdDate;
	
	@Column(name="LANG_CODE") 
	private String languageCode;
	
	@Column(name="ALLOW_PASSWORD_CHANGE") 
	private Boolean allowPasswordChange;
	
	@Column(name="EXPIRY_DATE") 
	private Date expiryDate;
	
	@Column(name="USER_STATUS") 
	private String userStatus;
	
	@Column(name="EMAIL") 
	private String emailId;
	
	@Column(name="LEGAL_ACCEPTEDBLE") 
	private String legalAcceptable;
	
	@Column(name="USER_CODE") 
	private String userCode;
	
	@Column(name="PASSWORD_EXPIRES") 
	private Date passwordExpireDate;
	
	@Column(name="PHONE") 
	private String phone;
	
	@Column(name="SSN") 
	private String ssn;
	
	@Column(name="INITI_AL") 
	private String initial;
	
	@Column(name="IMG_SRC") 
	private String imageSourc;
	
	@OneToMany(cascade = {CascadeType.ALL},fetch = FetchType.EAGER )
	@JoinColumn(name="REF_ID")
	private Set<UserAddress> address = new HashSet<UserAddress>();
	
	@OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.EAGER)
	@JoinColumn(name="REF_ID")
	private Set<UserRoles> roles = new HashSet<UserRoles>();
	
	
	
	@Transient
	private String rePassword;
	
	public Integer getUserId() {
		return userId;
	}
	public void setUserId(Integer userId) {
		this.userId = userId;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public Integer getCreatedBy() {
		return createdBy;
	}
	public void setCreatedBy(Integer createdBy) {
		this.createdBy = createdBy;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public String getQuestion() {
		return question;
	}
	public void setQuestion(String question) {
		this.question = question;
	}
	public String getAnswer() {
		return answer;
	}
	public void setAnswer(String answer) {
		this.answer = answer;
	}
	public Date getCreatedDate() {
		return createdDate;
	}
	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}
	public String getLanguageCode() {
		return languageCode;
	}
	public void setLanguageCode(String languageCode) {
		this.languageCode = languageCode;
	}
	public Boolean getAllowPasswordChange() {
		return allowPasswordChange;
	}
	public void setAllowPasswordChange(Boolean allowPasswordChange) {
		this.allowPasswordChange = allowPasswordChange;
	}
	public Date getExpiryDate() {
		return expiryDate;
	}
	public void setExpiryDate(Date expiryDate) {
		this.expiryDate = expiryDate;
	}
	public String getUserStatus() {
		return userStatus;
	}
	public void setUserStatus(String userStatus) {
		this.userStatus = userStatus;
	}
	public String getEmailId() {
		return emailId;
	}
	public void setEmailId(String emailId) {
		this.emailId = emailId;
	}
	public String getLegalAcceptable() {
		return legalAcceptable;
	}
	public void setLegalAcceptable(String legalAcceptable) {
		this.legalAcceptable = legalAcceptable;
	}
	public String getUserCode() {
		return userCode;
	}
	public void setUserCode(String userCode) {
		this.userCode = userCode;
	}
	public Date getPasswordExpireDate() {
		return passwordExpireDate;
	}
	public void setPasswordExpireDate(Date passwordExpireDate) {
		this.passwordExpireDate = passwordExpireDate;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getSsn() {
		return ssn;
	}
	public void setSsn(String ssn) {
		this.ssn = ssn;
	}
	public String getInitial() {
		return initial;
	}
	public void setInitial(String initial) {
		this.initial = initial;
	}
	public String getImageSourc() {
		return imageSourc;
	}
	public void setImageSourc(String imageSourc) {
		this.imageSourc = imageSourc;
	}
	
	public String getRePassword() {
		return rePassword;
	}
	public void setRePassword(String rePassword) {
		this.rePassword = rePassword;
	}
	public Integer getReferenceId() {
		return referenceId;
	}
	public void setReferenceId(Integer referenceId) {
		this.referenceId = referenceId;
	}
	
	@Transactional
	public Set<UserRoles> getRoles() {
		return roles;
	}
	
	public void setRoles(Set<UserRoles> roles) {
		this.roles = roles;
	}
	public Set<UserAddress> getAddress() {
		return address;
	}
	public void setAddress(Set<UserAddress> address) {
		this.address = address;
	}

	
}
